// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Components/SceneComponent.h"
#include "Components/TextRenderComponent.h"
#include "ProceduralMeshComponent.h"
#include "Materials/MaterialInstanceDynamic.h"
#include "ProcedrualBarComponent.generated.h"


class UProceduralMeshComponent;

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class VISUALCHARTFX_API UProcedrualBarComponent : public USceneComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UProcedrualBarComponent();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;
	virtual void OnRegister() override;

public:	
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	UFUNCTION(BlueprintCallable)
	void SetColor(const FLinearColor Color);

	UFUNCTION(BlueprintCallable)
	void Rebuild(float Width, float Height, float Bevel, UMaterialInterface* MaterialMesh,
		FString LabelName, FString LabelValue, UMaterialInterface* MaterialLabel);

protected:

	UPROPERTY(EditAnywhere, BlueprintReadOnly) 
	TObjectPtr<UProceduralMeshComponent> PMeshComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TObjectPtr<UTextRenderComponent> LabelNameComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TObjectPtr<UTextRenderComponent> LabelValueComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TObjectPtr<UMaterialInstanceDynamic> MaterialInstance;
		
};
